/**
 * [cache Html5本地存储]
 * @param  {[type]} name [名称]
 * @param  {[type]} data [内容]
 * @param  {[type]} type [类型]
 * @return {[type]}      [返回]
 */
//data 命名不能为del**2015.9.9
function cache(name,data,type){
	if (type == 'json') {
		//console.log('json');
		window.localStorage.setItem(name,JSON.stringify(data));
		return true;
	}
	if (data == 'del') {
		localStorage.removeItem(name);
	};
	if(isNull(name) + isNull(data) == 2){
		//console.log(name);
		window.localStorage.setItem(name,data);
		return true;
	};
	if (isNull(name) == 1) {
		//console.log(window.localStorage.key(name));
		return window.localStorage.getItem(name);
	};
}
/**
 * [isNull 判断是否为空]
 * @param  {[type]}  data [description]
 * @return {Boolean}      [description]
 */
function isNull(data){ 
	return (data == "" || data == undefined || data == null) ? -1 : 1; 
}